
var RankPageLayer = cc.Layer.extend({
	sprite:null,
	btn_Start:null,
	user_Lists:null,
	pic_Rankback:null,
	pic_Ranktop:null,
	txt_1:null,
	txt_2:null,
	txt_3:null,
	num_Fx:0,
	num_Fy:0,
	num_Add:0,
	ctor:function () {
		//////////////////////////////
		// 1. super init first
		this._super();

		/////////////////////////////
		// 2. add a menu item with "X" image, which is clicked to quit the program
		//    you may modify it.
		// ask the window size
		var size = cc.winSize;

		this.num_Fx=133;
		this.num_Fy=796;
		this.num_Add=110;
		// add a "close" icon to exit the progress. it's an autorelease object
		
		
		
		
		var startScene=ccs.load(res.rankscene_json).node;
		this.addChild(startScene);

		pic_Rankback=startScene.getChildByName("Image_1");
		pic_Rankback.setScaleY(theScaleH);
		
		pic_Ranktop=startScene.getChildByName("Image_5");
		pic_Ranktop.y=901.20+size.height-1024;
		
		
		
		txt_1=startScene.getChildByName("BitmapFontLabel_1");
		txt_2=startScene.getChildByName("BitmapFontLabel_1_1");
		txt_3=startScene.getChildByName("BitmapFontLabel_1_1_0");
		txt_1.y=815+size.height-1024;
		txt_2.y=815+size.height-1024;
		txt_3.y=815+size.height-1024;
		
		user_Lists=startScene.getChildByName("UserLists");
		user_Lists.height=780+size.height-1024;
		//var item1=new RankItem(1,"刘汝锋",1001);
		//item1.setPosition(this.num_Fx, this.num_Fy);
		var long=this.num_Add*g_Array_Users.length+10;
		if (long<780+size.height-1024) {
			long=780+size.height-1024;
		}
		for (var i = g_Array_Users.length; i >=1; i--) {
			var item=new RankItem(i,g_Array_Users[i-1][1],g_Array_Users[i-1][2],g_Array_Users[i-1][4]);
			item.setPosition(this.num_Fx, long-10-this.num_Add*(i-1)-25);
			user_Lists.addChild(item, 3);
		}
		
		
		
		user_Lists.setInnerContainerSize(cc.size(768,long));
		
		//user_Lists.setInnerContainerSize(0.1f, false);  
		btn_Start=ccui.helper.seekWidgetByName(startScene, "Button_1");
		btn_Start.addTouchEventListener(this.backClick);
		btn_Start.y+=size.height-1024;
		var userinfo=new UserInfo();
		userinfo.setPosition(384,990+size.height-1024);
		this.addChild(userinfo, 30);

		return true;
	},
	backClick:function(sender,type)
	{
		switch (type) {        
		//pageView当前所在的page的index发生了变化。
		case ccui.Widget.TOUCH_ENDED:
//			helloworldl.resetItems(0);
			//insertData(77,"qiqi",77777);
			//g_String_serNmae=share(1,g_Value_gameScore);
//			share(1);
			cc.director.runScene(new StartPageScene());
			break;        
		default:  break;
		}
	}
});

var RankPageScene = cc.Scene.extend({
	onEnter:function () {
		this._super();
		var layer = new RankPageLayer();
		this.addChild(layer);
	}
});

